<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>Geeklog Documentation - Variables in Themes</title>
  <link rel="stylesheet" type="text/css" href="../docstyle.css" title="Dev Stylesheet">
</head>

<body>
<p><a href="http://www.geeklog.net/" style="background:transparent"><img src="../images/newlogo.gif" alt="Geeklog" width="243" height="90"></a></p>
<div class="menu"><a href="index.html">Geeklog Documentation</a> - Variables in Themes</div>

<h1>Variables in Themes</h1>

<p><strong>Note:</strong> This is not a complete documentation of the theme
variables - it only covers variables that can be used in the site header and
in story templates.</p>

<h2>Introduction</h2>

<p>Geeklog uses the template engine of the <a href="http://phplib.sf.net/">PHP
Base Library</a> (also known as PHPlib). This library allows the use of
so-called variables in the template files. A variable is a word enclosed in
curly brackets, like this: <code>{variable}</code>. When Geeklog creates a web
page it will replace the variables in the template files with certain values.
A variable can hold static text (i.e. it will alway be replaced with the same
text), dynamic content (e.g. the number of comments to a story or the entire
text of a story), or even the content of another template file (used for lists,
for example).</p>

<p>Please note that not all variables are available in all template files.
While the variable <code>{site_url}</code> (which holds the URL of your Geeklog
site) is available in most template files, many variables are only available
in one template file (e.g. the variable <code>{formatted_article}</code> is only
available in the <tt>article.thtml</tt> template file). Geeklog will remove any
variables which are not defined for the current template file (i.e. they will
be replaced with an empty string). No error or warning messages will be
created when you use an undefined variable.</p>


<h2><a name="site-header">Site Header</a></h2>

<p>The following variables are available in the site header, i.e. in the
<tt>header.thtml</tt> template file:</p>

<table border="1" width="100%" cellpadding="2">
<tr><th style="width:8%">Variable</th>
    <th style="width:29%">Example</th>
    <th style="width:63%">Description</th></tr>
<tr><td><code>site_url</code></td>
    <td><tt>http://www.example.com</tt></td>
    <td>The URL of your Geeklog site (the exact same URL you specified in
        <code>$_CONF['site_url']</code> in the configuration.</td></tr>
<tr><td><code>layout_url</code></td>
    <td><tt>http://www.example.com/layout/professional</tt></td>
    <td>The URL of the layout folder of the user's current theme.</td></tr>
<tr><td><code>page_title</code></td>
    <td>Geeklog Site - Another Nifty Geeklog Site</td>
    <td>Holds either the site's name and slogan or the site name and the title
        of the current story.</td></tr>
<tr><td><code>background_image</code></td>
    <td><tt>http://www.example.com/layout/<br>XSilver/images/bg.gif</tt></td>
    <td>Points to a file named <tt>bg.gif</tt> in the <tt>images</tt> folder of
        the current theme, intended to be used as a background image.</td></tr>
<tr><td><code>site_mail</code></td>
    <td><tt>admin@example.com</tt></td>
    <td>Email address where people can contact the site's administrator.
        Because of the spam problem, it is recommended you don't actually use
        this on your site and provide a link to the Admin's email submission
        form instead: <tt>{site_url}/profiles.php?uid=2</tt> (where "2" is the
        user id of the person who will receive the email, usually the Admin
        user.</td></tr>
<tr><td><code>site_name</code></td>
    <td>Geeklog Site</td>
    <td>The name of your Geeklog site.</td></tr>
<tr><td><code>site_slogan</code></td>
    <td>Another Nifty Geeklog Site</td>
    <td>The slogan of your site.</td></tr>
<tr><td><code>welcome_msg</code></td>
    <td>Welcome to Geeklog Site</td>
    <td>A welcome message, followed by the user's name (for registered
        users).</td></tr>
<tr><td><code>datetime</code></td>
    <td>Thursday, November 28 2002 @ 11:43 AM PST</td>
    <td>The current date and time, formatted according to
        <code>$_CONF['date']</code>.</td></tr>
<tr><td><code>site_logo</code></td>
    <td><tt>http://www.example.com/layout/<br>professional/images/logo.png</tt></td>
    <td>Points to the logo image in the <tt>images</tt> directory of the
        current theme, intended to be used as the site's logo. This is usually
        a GIF image (<tt>logo.gif</tt>), but the image type can be overwritten
        by the theme (the Professional theme, for example, uses PNG images, and
        so the logo is a PNG file, <tt>logo.png</tt>, too).</td></tr>
<tr><td><code>css_url</code></td>
    <td><tt>http://www.example.com/layout/<br>professional/style.css</tt></td>
    <td>Points to the style sheet of the current theme.</td></tr>
<tr><td><code>theme</code></td>
    <td>professional</td>
    <td>Name of the current theme.</td></tr>
<tr><td><code>charset</code></td>
    <td>iso-8859-1</td>
    <td>The character set for the current language file.</td></tr>
<tr><td><code>lang_id</code></td>
    <td><tt>en-GB</tt>
    <td>An ID representing the language used on your site. Ideally, this should
        be an ISO language/country code, e.g. 'en-GB' for British English. The
        value for this variable is the language shortcut used in the
        <code>$_CONF['languages']</code> array when multi-language support is
        enabled. Otherwise, it's derived from <code>$_CONF['locale']</code>,
        which involves some guesswork. In the latter case, this may also end
        up with a value like 'German' if your site is running on a non-Unix
        system (and which is not a valid ISO code).</td></tr>
<tr><td><code>lang_attribute</code></td>
    <td><tt>lang="en-GB"</tt>
    <td>An <a href="http://www.w3.org/TR/html4/struct/dirlang.html#adef-lang">HTML lang attribute</a> (including the value) to be used in your site
        header's HTML to indicate the language of your site or of the current
        page, e.g. like so: <pre>&lt;html {lang_attribute}&gt;</pre>
        Please note that this variable is <em>empty</em>, i.e. not set, when
        the site's language ID does not appear to be a <a href="http://www.w3.org/TR/html4/struct/dirlang.html#langcodes">valid language code</a> (see
        description of the <code>lang_id</code> variable above).</td></tr>
<tr><td><code>feed_url</code></td>
    <td><tt>&lt;link rel="alternate" type="application/rss+xml" hreflang="en-gb" href="http://www.example.com/backend/geeklog.rss" title="RSS Feed: Geeklog"&gt;</tt></td>
    <td>Provides links to all the relevant feeds for the current page
        (depending on the "header link in topic" setting in the Feed Editor).</td></tr>
<tr><td><code>rss_url</code></td>
    <td><tt>http://www.example.com/backend/geeklog.rdf</tt></td>
    <td>The URL of your site's RSS feed (identical to <code>{rdf_file}</code>.
        This variable is also available in the site's <tt>footer.thtml</tt>.
        <strong>Deprecated:</strong> Use <code>{feed_url}</code> instead.</td></tr>
<tr><td><code>rdf_file</code></td>
    <td><tt>http://www.example.com/backend/geeklog.rdf</tt></td>
    <td>The URL of your site's RSS feed (identical to <code>{rss_url}</code>.
        This variable is also available in the site's <tt>footer.thtml</tt>.
        <strong>Deprecated:</strong> Use <code>{feed_url}</code> instead.</td></tr>
<tr><td><code>rel_links</code></td>
    <td><tt>&lt;link rel="home" href="http://www.example.com/" title="Home"&gt;</tt></td>
    <td>Provides a set of predefined <a href="http://www.w3.org/TR/html4/struct/links.html#edef-LINK">link tags</a>, offering additional navigation links and
        relationship information.</td></tr>
<tr><td><code>page_title_and_site_name</code></td>
    <td><tt>Geeklog Site - Another Nifty Geeklog Site</tt></td>
    <td>As the name suggests, this variable provides the site name and the title
        for the current page. The order in which these two are provided depends
        on the current location on the website: On the site's frontpage, the
        site name comes first. On all the other pages, the current page title
        comes first.</td></tr>
<tr><td><code>page_site_splitter</code></td>
    <td><tt> - </tt> (a dash surrounded by spaces)</td>
    <td>This variable comes in handy when creating your own page title, as it
        will be empty when the <code>{page_title}</code> variable is empty. Use
        in combination with <code>{page_title}</code> and
        <code>{site_name}</code> (see above).</td></tr>
</table>


<h2><a name="story">Stories</a></h2>

<p>The following variables are available in the <tt>storytext.thtml</tt>,
<tt>storybodytext.thtml</tt>, <tt>featuredstorytext.thtml</tt>,
<tt>featuredstorybodytext.thtml</tt>, <tt>archivestorytext.thtml</tt>, and
<tt>archivestorybodytext.thtml</tt>  template files. These files are used to
render stories for the index page as well as the content of the
<code>{formatted_article}</code> variable in the <tt>article/article.thtml</tt>
file (which is used to display a story on its own page).</p>

<table border="1" width="100%" cellpadding="2">
<tr><th style="width:8%">Variable</th>
    <th style="width:29%">Example</th>
    <th style="width:63%">Description</th></tr>
<tr><td><code>site_url</code></td>
    <td><tt>http://www.example.com</tt></td>
    <td>The URL of your Geeklog site (the exact same URL you specified in
        <code>$_CONF['site_url']</code> in the configuration.</td></tr>
<tr><td><code>layout_url</code></td>
    <td><tt>http://www.example.com/layout/professional</tt></td>
    <td>The URL of the layout folder of the user's current theme.</td></tr>
<tr><td><code>story_date</code></td>
    <td>Tuesday, October 22 2002 @ 11:50 PM PDT</td>
    <td>The date and time of the story, formatted according to the user's
        preferred date and time format.</td></tr>
<tr><td><code>story_date_only</code></td>
    <td>22-Oct</td>
    <td>The date of the story, formatted using
        $_CONF['<a href="config.html#desc_dateonly">dateonly</a>'].</td></tr>
<tr><td><code>story_date_short</code></td>
    <td>10/22/02</td>
    <td>The date of the story, formatted using
        $_CONF['<a href="config.html#desc_shortdate">shortdate</a>'].</td></tr>
<tr><td><code>lang_views</code></td>
    <td>Views</td>
    <td>The word "Views" in the user's preferred language.</td></tr>
<tr><td><code>story_hits</code></td>
    <td>42</td>
    <td>Number of times the story was read.</td></tr>
<tr><td><code>article_url</code></td>
    <td>http://www.geeklog.net/article.php?story=20021022234959146</td>
    <td>The full URL to the story on its own page (article.php). This will also
        reflect the correct URL when URL rewriting is activated.</td></tr>
<tr><td><code>story_id</code></td>
    <td>20021022234959146</td>
    <td>The ID of a story (can be used to build URLs, e.g. for a "link to this
        story" link).</td></tr>
<tr><td><code>story_title</code></td>
    <td>Welcome to Geeklog!</td>
    <td>The title of the story.</td></tr>
<tr><td><code>story_introtext</code></td>
    <td>Welcome and let me be the first to congratulate you on installing Geeklog ...</td>
    <td>When displayed on the index page, this variable contains The "intro
        text" part of a story. However, when displayed as an article on a
        single page, it contains <em>both</em> the intro text <em>and</em> the
        body text of the story.</td></tr>
<tr><td><code>story_text_no_br</code></td>
    <td>Welcome and let me be the first to congratulate you on installing Geeklog ...</td>
    <td>When displayed on the index page, this variable contains The "intro
        text" part of a story. However, when displayed as an article on a
        single page, it contains <em>both</em> the intro text <em>and</em> the
        body text of the story. The difference between <tt>story_introtext</tt>
        and <tt>story_text_no_br</tt> is that <tt>story_introtext</tt> inserts
        two HTML <tt>&lt;br&gt;</tt> tags between the intro and the body text
        whereas <tt>story_text_no_br</tt> does not do that (hence the name).</td></tr>
<tr><td><code>story_introtext_only</code></td>
    <td>Welcome and let me be the first to congratulate you on installing Geeklog ...</td>
    <td>As the name implies, this variable <em>always</em> contains
        <em>only</em> the story's intro text portion.</td>
<tr><td><code>story_bodytext_only</code></td>
    <td><i>(...)</i></td>
    <td>This variable is only set when displaying the entire story. It contains
        <em>only</em> the body text portion of the story, if
        available.</td></tr>
<tr><td><code>lang_todays_featured_article</code></td>
    <td>Today's Featured Article</td>
    <td>The words "Today's Featured Article" in the user's preferred language.
        <strong>Only available when the story is the featured story.</strong></td></tr>
<tr><td><code>story_counter</code></td>
    <td>1</td>
    <td>On the site's index page (<tt>index.php</tt>), this variable contains
        1 for the first story, 2 for the second, etc. This is independent
        whether the first story is a featured story or not. The counter restarts
        with every new page (<tt>index.php?page=2</tt>, etc.).<br>
        The variable contains 0 on the article page (<tt>article.php</tt>) and
        in story previews.</td></tr>
</table>

<p>The <a name="readmore">following variables</a> are only available when the
story is displayed on the index page <em>and</em> the body text of the story is
<em>not</em> empty:</p>

<table border="1" width="100%" cellpadding="2">
<tr><th style="width:8%">Variable</th>
    <th style="width:29%">Example</th>
    <th style="width:63%">Description</th></tr>
<tr><td><code>lang_readmore</code></td>
    <td>read more</td>
    <td>The words "read more" in the user's preferred language.</td></tr>
<tr><td><code>lang_readmore_words</code></td>
    <td>words</td>
    <td>The word "words" in the user's preferred language.</td></tr>
<tr><td><code>readmore_words</code></td>
    <td>62</td>
    <td>The number of words in the body text of the story.</td></tr>
<tr><td><code>readmore_link</code></td>
    <td><code>&lt;a href="..."&gt;read more&lt;/a&gt; (62 words)</code></td>
    <td>Link to the story on a separate page, including the number of word in
        the body text.</td></tr>
<tr><td><code>start_readmore_anchortag</code></td>
    <td><code>&lt;a href=".../article.php<br>?story=20021022234959146"&gt;</code></td>
    <td>Opening tag for a link to the story on a separate page.</td></tr>
<tr><td><code>end_readmore_anchortag</code></td>
    <td><code>&lt;/a&gt;</code></td>
    <td>Closing tag for a link to the story.</td></tr>
<tr><td><code>read_more_class</code></td>
    <td>class="story-read-more"</td>
    <td>This variable is empty when the body text is empty and contains the
        class attribute when the body text is not empty. Use the
        <code>story-read-more</code> class to change the layout of the "read
        more" link.</td></tr>
<tr><td><code>email_icon</code></td>
    <td>(icon)</td>
    <td>The email icon, linking to the form to send the article to a
        friend.</td></tr>
<tr><td><code>email_story_url</code></td>
    <td><tt>http://.../profiles.php?sid=welcome</tt></td>
    <td>The URL of the form to send the article to a friend.</td></tr>
<tr><td><code>print_icon</code></td>
    <td>(icon)</td>
    <td>The printer icon, linking to a "printer friendly" version of the story.</td></tr>
<tr><td><code>recent_post_anchortag</code></td>
    <td>--</td>
    <td>When no comments have been posted yet, this variable contains just a
        link to the comment submission form (just like
        <code>{post_comment_link}</code>). When there are comments to the story,
        then this variable does <em>not</em> contain a link but instead
        contains the user name of the person who posted the last comment as well
        as the date and time when that comment was posted.</td></tr>
</table>

<p>The following variables are only available when comments on a story are
enabled and when comments have been made to the story already:</p>

<table border="1" width="100%" cellpadding="2">
<tr><th style="width:8%">Variable</th>
    <th style="width:29%">Example</th>
    <th style="width:63%">Description</th></tr>
<tr><td><code>comments_url</code></td>
    <td><tt>http://www.example.com/article.php<br>?story=20021022234959146#comments</tt></td>
    <td>URL of the comments section (when a story is displayed on a separate
        page).</td></tr>
<tr><td><code>comments_text</code></td>
    <td>2 comments</td>
    <td>The number of comments, followed by the word "comments" in the user's
        preferred language.</td></tr>
<tr><td><code>comments_with_count</code></td>
    <td>2</td>
    <td>The number of comments to the story (will always be 1 or greater). <br>This string becomes a link as soon as there are comments available, pointing to <code>&lt;a href=".../article.php?story=20021022234959146#comments"&gt;</code></td></tr>
<tr><td><code>comments_with_count</code></td>
    <td>2</td>
    <td>The number of comments to story only (may be 0).</td></tr>
<tr><td><code>lang_comments</code></td>
    <td>comments</td>
    <td>The word "comments" in the user's preferred language.</td></tr>
<tr><td><code>post_comment_link</code></td>
    <td><code>&lt;a href=".../comment.php<br>?sid=20021022234959146&amp;pid=0<br>&amp;type=article"&gt;Post a comment&lt;/a&gt;</code></td>
    <td>Link to the comment submission form (using "Post a comment" in the
        user's preferred language as the link text).</td></tr>
</table>

<p>The following variables are only available when
<code>$_CONF['contributedbyline'] = 1;</code> in the configuration, i.e.
when you allow the name of the story's author to be displayed:</p>

<table border="1" width="100%" cellpadding="2">
<tr><th style="width:8%">Variable</th>
    <th style="width:29%">Example</th>
    <th style="width:63%">Description</th></tr>
<tr><td><code>lang_contributed_by</code></td>
    <td>Contributed by:</td>
    <td>The text "Contributed by:" in the user's preferred language.</td></tr>
<tr><td><code>contributedby_uid</code></td>
    <td>7</td>
    <td>The user id of the story's author.</td></tr>
<tr><td><code>contributedby_user</code></td>
    <td>Tony</td>
    <td>The user name (short name) of the story's author.</td></tr>
<tr><td><code>contributedby_fullname</code></td>
    <td>Tony Bibbs</td>
    <td>The full name of the story's author. If the user hasn't filled in
        his/her full name, the user name is used instead.</td></tr>
<tr><td><code>contributedby_author</code></td>
    <td>Tony Bibbs</td>
    <td>The name of the story's author. If <code>$_CONF['show_fullname']</code>
        is enabled, it will contain the author's full name (if provided).
        Otherwise, it will contain the user name.</td></tr>
<tr><td><code>start_contributedby_anchortag</code></td>
    <td><code>&lt;a class="storybyline" href="http://www.example.com/<br>users.php?mode=profile&amp;uid=7"&gt;</code></td>
    <td>Opening tag for a link to the story author's profile (empty for
        anonymous authors).</td></tr>
<tr><td><code>end_contributedby_anchortag</code></td>
    <td><code>&lt;/a&gt;</code></td>
    <td>Closing tag for a link to the story author's profile (empty for
        anonymous authors).</td></tr>
<tr><td><code>contributedby_url</code></td>
    <td><tt>http://www.example.com/<br>users.php?mode=profile&amp;uid=7</tt></td>
    <td>Link to the story author's profile (empty for anonymous authors).</td></tr>
<tr><td><code>contributedby_photo</code></td>
    <td><tt>&lt;img src=".../images/userphotos/Tony.gif" alt="Tony Bibbs"&gt;</tt></td>
    <td>User photo of the story author, if provided (and user photos are <a
        href="config.html#desc_allow_user_photo">enabled</a>). For anonymous
        users, this will be an empty string, unless use of <a
        href="config.html#desc_use_gravatar">Gravatars</a> is enabled or a <a
        href="config.html#desc_default_photo">default photo</a> is
        configured.</td></tr>
<tr><td><code>author_photo</code></td>
    <td><i>(see above)</i></td>
    <td>Same as <tt>{contributedby_photo}</tt></td></tr>
<tr><td><code>camera_icon</code></td>
    <td>small camera icon and link to the author's user profile</td>
    <td>Displays the camera icon (the same as in the Who's Online block) and
        links to the author's user profile if they have uploaded a user photo
        (never displayed for anonymous authors).</td></tr>
</table>

<p>The following variables are only available if topic icons are enabled for
the story <em>and</em> the user has not disabled topic icons in his/her
display preferences:</p>

<table border="1" width="100%" cellpadding="2">
<tr><th style="width:8%">Variable</th>
    <th style="width:29%">Example</th>
    <th style="width:63%">Description</th></tr>
<tr><td><code>story_anchortag_and_image</code></td>
    <td><code>&lt;a href="http://www.example.com/<br>index.php?topic=Geeklog"&gt;&lt;img src="..." ...&gt;&lt;/a&gt;</code> <small>(shortened)</small></td>
    <td>Topic icon for the story's topic, enclosed in a link to the site's
        index page, sorted by topic.</td></tr>
<tr><td><code>story_anchortag_and_image_no_align</code></td>
    <td><code>&lt;a href="http://www.example.com/<br>index.php?topic=Geeklog"&gt;&lt;img src="..." ...&gt;&lt;/a&gt;</code> <small>(shortened)</small></td>
    <td>Same as <code>{story_anchortag_and_image}</code> but without the
        <code>align</code> attribute for the topic image.</td></tr>
<tr><td><code>story_topic_image</code></td>
    <td><code>&lt;img src="http://www.example.com/<br>images/topics/topic_gl.gif" align="right" alt="Geeklog" title="Geeklog"&gt;</code></td>
    <td>Topic icon for the story.</td></tr>
<tr><td><code>story_topic_image_no_align</code></td>
    <td><code>&lt;img src="http://www.example.com/<br>images/topics/topic_gl.gif" alt="Geeklog" title="Geeklog"&gt;</code></td>
    <td>Same as <code>{story_topic_image}</code> but without the
        <code>align</code> attribute for the topic image.</td></tr>
<tr><td><code>story_topic_image_url</code></td>
    <td><code>http://www.example.com/<br>images/topics/topic_gl.gif</code></td>
    <td>Just the URL of the topic icon.</td></tr>
<tr><td><code>story_topic_id</code></td>
    <td>General</td>
    <td>Id (internal name) of the topic, e.g. to be used in links.</td></tr>
<tr><td><code>story_topic_name</code></td>
    <td>General News</td>
    <td>Topic name (as seen on the Sections block).</td></tr>
<tr><td><code>story_topic_url</code></td>
    <td><code>&lt;a href="http://www.example.com/<br>index.php?topic=General"&gt;</code></td>
    <td>URL to your site's index page, so that only stories with the story's
        topic are displayed.</td></tr>
</table>

<p>The following variables are only available when the current user has the
permissions to edit a story:</p>

<table border="1" width="100%" cellpadding="2">
<tr><th style="width:8%">Variable</th>
    <th style="width:29%">Example</th>
    <th style="width:63%">Description</th></tr>
<tr><td><code>edit_link</code></td>
    <td><code>&lt;a href=".../admin/story.php<br>?mode=edit&amp;sid=20021022234959146"&gt;edit&lt;/a&gt;</code></td>
    <td>Link to open the story in the admin's story editor.</td></tr>
<tr><td><code>edit_icon</code></td>
    <td><code>&lt;a href=".../admin/story.php<br>?mode=edit&amp;sid=20021022234959146"&gt;&lt;img src=".../images/edit.gif"&gt;&lt;/a&gt;</code></td>
    <td>An icon linking to the admin's story editor to edit the story.</td></tr>
<tr><td><code>edit_image</code></td>
    <td><code>&lt;img src=".../images/edit.gif"&gt;</code></td>
    <td>Only the <code>img</code> tag for the edit icon, without the
        link.</td></tr>
<tr><td><code>edit_url</code></td>
    <td><tt>http://www.example.com/admin/story.php<br>?mode=edit&amp;sid=20021022234959146</tt></td>
    <td>URL to open the story in the admin's story editor</td></tr>
<tr><td><code>lang_edit_text</code></td>
    <td>edit</td>
    <td>The word "edit" in the user's preferred language.</td></tr>
</table>

<div class="footer">
    <a href="http://wiki.geeklog.net/">The Geeklog Documentation Project</a><br>
    All trademarks and copyrights on this page are owned by their respective owners. Geeklog is copyleft.
</div>
</body>
</html>
